package com.bian.springboot.contorller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author bianpengfei
 * @create 2019-02-01 15:46
 **/
@Controller
public class HelloContorller {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @ResponseBody
    @GetMapping("/query")
    public List<Map<String, Object>> list() {
        List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT * FROM  department");
        return maps;
    }
}
